// 2013-8-1下午04:18:24  net.betou.trade.entity.main.base.BaseTrade.java

package net.betou.trade.entity.main.base;

import java.io.Serializable;
import java.util.Date;

import net.betou.trade.entity.main.AgentAndAdmins;
import net.betou.trade.entity.main.Category;
import net.betou.trade.entity.main.Trade;

/**
 * 喊单
 * @author 叶装装
 */
public abstract class BaseTrade implements Serializable{

	public BaseTrade( ){}
	
	private Integer id; // 
	
	private String smsGroups; // 发送短信的用户组
	private String orientedGroup; // 面向的用户, 多个分组之间使用“,” 号分隔
	private Boolean direction; // 喊单方向, 0为多单，1为空单
	private Double openPosition; // 使用double, 更精确的控制  开仓点位
	private Double stopPosition; // 止损点位
	private Double longPosition; // 止盈点位
	private Double closePosition; // 平仓点位
	private Double profit; // 盈利点位
	private Date startDate; // 开仓时间
	private Date endDate; // 平仓时间
	private String openReason; // 开仓理由
	private String closeReason; // 平仓理由
	private Boolean status; // 开仓还是平仓, 1是开仓,0是平仓
	
	
	// many to one
	private AgentAndAdmins admin; // 添加的管理员
	private Category category;          // 品种
	
	
	private static final long serialVersionUID = 1107086203213331304L;

	public Integer getId( ) {
		return id;
	}

	public void setId( Integer id ) {
		this.id = id;
	}

	public String getOrientedGroup( ) {
		return orientedGroup;
	}

	public void setOrientedGroup( String orientedGroup ) {
		this.orientedGroup = orientedGroup;
	}

	public Boolean getDirection( ) {
		return direction;
	}

	public void setDirection( Boolean direction ) {
		this.direction = direction;
	}

	public Double getOpenPosition( ) {
		return openPosition;
	}

	public void setOpenPosition( Double openPosition ) {
		this.openPosition = openPosition;
	}

	public Double getStopPosition( ) {
		return stopPosition;
	}

	public void setStopPosition( Double stopPosition ) {
		this.stopPosition = stopPosition;
	}

	public Double getLongPosition( ) {
		return longPosition;
	}

	public void setLongPosition( Double longPosition ) {
		this.longPosition = longPosition;
	}

	public Double getClosePosition( ) {
		return closePosition;
	}

	public void setClosePosition( Double closePosition ) {
		this.closePosition = closePosition;
	}

	public Double getProfit( ) {
		return profit;
	}

	public void setProfit( Double profit ) {
		this.profit = profit;
	}

	public Date getStartDate( ) {
		return startDate;
	}

	public void setStartDate( Date startDate ) {
		this.startDate = startDate;
	}

	public Date getEndDate( ) {
		return endDate;
	}

	public void setEndDate( Date endDate ) {
		this.endDate = endDate;
	}

	public String getOpenReason( ) {
		return openReason;
	}

	public void setOpenReason( String openReason ) {
		this.openReason = openReason;
	}

	public String getCloseReason( ) {
		return closeReason;
	}

	public void setCloseReason( String closeReason ) {
		this.closeReason = closeReason;
	}

	public Boolean getStatus( ) {
		return status;
	}

	public void setStatus( Boolean status ) {
		this.status = status;
	}

	public AgentAndAdmins getAdmin( ) {
		return admin;
	}

	public void setAdmin( AgentAndAdmins admin ) {
		this.admin = admin;
	}

	public Category getCategory( ) {
		return category;
	}

	public void setCategory( Category category ) {
		this.category = category;
	}

	public String getSmsGroups( ) {
		return smsGroups;
	}

	public void setSmsGroups( String smsGroups ) {
		this.smsGroups = smsGroups;
	}

	private int hashCode = Integer.MIN_VALUE;
	
	public boolean equals( Object obj ) {
		if( null == obj )
			return false;
		if( !( obj instanceof Trade ) )
			return false;
		else{
			Trade trade = ( Trade ) obj;
			if( null == this.getId( ) || null == trade.getId( ) )
				return false;
			else
				return( this.getId( ).equals( trade.getId( ) ) );
		}
	}

	public int hashCode( ) {
		if( Integer.MIN_VALUE == this.hashCode ){
			if( null == this.getId( ) )
				return super.hashCode( );
			else{
				String hashStr = this.getClass( ).getName( ) + ":" + this.getId( ).hashCode( );
				this.hashCode = hashStr.hashCode( );
			}
		}
		return this.hashCode;
	}
}
